﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using LINQtoFxCop.Core;

namespace LINQtoFxCop.Metrics.Namespaces
{
  public class NamespaceNbMethods : MetricsIntrospectionRule
  {
    protected NamespaceNbMethods(string name, string resourceName, Assembly assembly)
      : base(name, resourceName, assembly)
    { }
    public NamespaceNbMethods()
      : base("NamespaceNbMethods")
    { }

    protected override IEnumerable<QueryResult> Query()
    {
      return
        from @namespace in Namespaces
        where @namespace.NbMethods() > MetricThreshold()
        select Result(@namespace, @namespace.NbMethods());
    }
  }
}
